package com.ymatou.iapi.productmanager.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.productmanager.parameter.ProductBatchDto;
import com.ymatou.iapi.productmanager.parameter.SellerProductDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
/**
*查询待批量修改的商品列表Call
*FreeMaker Template自动生成代码
*/
public class QueryBatchProductListCall extends YmatouAutoTestCall{
	private static String opurl ="api/SellerProduct/QueryBatchProductList";
	
	public QueryBatchProductListCall() {
		super(EnvSetup.getSystemUrl("productmanager"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<ProductBatchDto> getProductList(){
		String sProductList=getJsonObject().get("Data").getAsJsonObject().get("productList").getAsJsonArray().toString();
		List<ProductBatchDto> ProductList=(List<ProductBatchDto>)FormatUtil.GSONToObject(sProductList, new TypeToken<List<ProductBatchDto>>(){}.getType());
		return ProductList;
	}
}